﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace GTA
{
    public class Building
    {
        public Building(Vector2 position)
        {
            this.position = position;
        }

        Texture2D texture;

        // Position of the building
        public Vector2 Position
        {
            get { return position; }
            set { position = value; }
        }
        Vector2 position;

        // For collision
        public Rectangle Rect
        {
            get { return rect; }
            set { rect = value; }
        }
        Rectangle rect;

        public void InitBuilding(ContentManager Content)
        {
            texture = Content.Load<Texture2D>("Objects/Doodads/building1");
            rect = new Rectangle((int)position.X, (int)position.Y, texture.Width, texture.Height);
        }

        public void Update()
        {
            rect = new Rectangle((int)position.X, (int)position.Y, texture.Width, texture.Height);
        }

        public void DrawBuilding(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(texture, Position, Color.White);
        }

        /* Custom functions */
        public bool Intersects(Rectangle a)
        {
            return rect.Intersects(a);
        }
    }
}
